<!--
<?php
error_reporting(0);
session_start();
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es" dir="ltr">
  <head>
    <title>PowerLaptops</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="default.css" />
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.tools.min.js"></script>
  </head>
  <body>
-->
    <noscript><p>Tu navegador no tiene activado javascript.</p></noscript>
      <div id="header" >
          <?php 
            if($_SESSION["autenticado"]!=1){
          ?>
            <div align="right" style="padding: 7px 38px 10px 0px;">
              <table>
                <tr>
                  <td style="padding-left: 8px; padding-right: 8px; cursor: pointer;" >
                    <a id="boton_login">
                      Mi cuenta
                    </a>
                  </td>
                  <td bgcolor="#3E79B3" width="1px" height="20px" ></td>
                  <td style="font-size: 13px;padding-left: 8px; padding-right: 8px;" >
                    <a id="boton_register" style="text-decoration: none; cursor: pointer;">
<!--                <a rel="#overlay" href="register_menu.php" style="text-decoration: none;"> -->
                      Registrarse
                    </a>
                  </td>
                  <td bgcolor="#3E79B3" width="1px" height="20px" ></td>
                  <td style="font-size: 13px;padding-left: 8px; padding-right: 8px;" >
                    <a href="comoComprar.php" style="text-decoration: none; ">Ayuda</a>
                  </td>
                </tr>
              </table>
            </div>
          <div id="signin_menu" class="signin_menu">
            <form name="iniciar" action="getUser.php" method="POST" enctype="multipart/form-data">
              <div style="padding-top: 10px;">
                  <img id="boton_login2" src="images/x-peq.jpg" alt="cerrar"
                       style="cursor: pointer; position: absolute; right: 0px;top: 0px;"/>
                  <table>
                  <tr>
                    <td><label style="width: 70px;display:inline-block;">Correo:</label></td>
                    <td><input type="text" name="login" value="" size="10" /></td>
                  </tr>
                  <tr>
                    <td><label style="width: 70px; "> Password: </label></td>
                    <td><input type="password" name="pass" value="" size="10" /></td>
                  </tr>
                </table>
              </div>
              <input type="image" 
                     src="images/top_low/botones/acceder.jpg"
                     onmouseover="src='images/acceder-peq.jpg'"
                     onmouseout="src='images/top_low/botones/acceder.jpg'"
                     alt="Acceder" />
              <!--
                <img style="padding-top: 5px;cursor: pointer;" name="registro"
                     stype="button" value="registrar" name="registrar"
                     src="images/top_low/botones/acceder.jpg" alt="Acceder"
                       onClick="javascript:comprueba2();"/>
              -->
            </form>
            <a href="recuperarClave.php"  style="font-size: 9px ">No recuerdas tu contraseña?</a>
            <script language="JavaScript" type="text/javascript">
              function comprueba2(){
              document.iniciar.submit();
              }
            </script>
          </div>
          <div id="register_menu" class="signin_menu" 
               style="background-image: url(images/top_low/logo2.jpg);
               background-repeat: no-repeat;
               width: 253px;">
            <div style="padding-top: 55px;">
            <form name = "registroUsuario" action="insertUser2.php" method="POST">
              <table align="center">
              <img id="boton_register2" 
                   style="position: absolute; right: 0px; top: 0px;cursor: pointer;"
                   src="images/x-grande.jpg" alt="cerrar" />
                  <table border=0>
                    <tr><td>Nombre</td>
                      <td><input type="text" onChange="verifNombre()" name="nombre" size="11" value="" /></td></tr>
                    <tr><td id="nombreMsn" class="hid"></td><td class="exTel"></td></tr>
                    <tr class="" id="rapellido"><td>Apellido</td><td><input type="text" onChange="verifApellido()" onkeypress="return noNumber(event)" name="apellido" size="11" value=""/></td></tr>
                    <tr><td id="apellido_top" class="hid"></td><td class="exTel"></td></tr>
                    <tr><td>C&eacute;dula o RIF
                          <select size="1" name="persona" onchange="swap()">
                            <option value="1">V</option>
                            <option value="0">J</option>
                          </select>
                        </td> <td>
                          <input type="text" 
                                 onChange="verifCITam()"
                                 name="ci"
                                 size="11"
                                 value="" />
                        </td>
                    </tr>
                    <tr><td id="ci_top" class="hid"></td><td class="exTel"></td></tr>
                    <tr><td>Tel&eacute;fono</td><td><input type="text" onchange="verifTelTam()"name="telefono" size="11" value=""/></td></tr>
                    <tr><td id="telefono_top" class="hid">*Siga el ejemplo.</td><td class="exTel">Ej: 02125553344</td></tr>
                    <tr><td>Correo electr&oacute;nico</td>
                      <td><input type="text" onChange="verifCorreo()" name="correo" size="11" value=""/></td></tr>
                    <tr><td id="correo_top" class="hid">*Correo incorrecto.</td><td class="exTel">Ej: correo@ejemplo.com</td></tr>
                    <tr><td>Contrase&ntilde;a</td><td><input type="password" name="contrasena" size="11" value=""/></td></tr>
                    <tr><td>Repita contrase&ntilde;a</td><td><input type="password" onChange="verifDistintas()" name="repetida" size="11" value="" /></td></tr>
                    <tr><td class="hid" id="clave_top">*Contraseñas distintas.</td><td></td></tr>
                  </table>
                  <center>
                    <img src="images/top_low/botones/registrarse.jpg"
                         onclick="javascript:comprueba();"
                         style="cursor: pointer;"
                         onmouseout="src='images/top_low/botones/registrarse.jpg'"
                         onmouseover="src='images/registrarse-grande.jpg'"
                         alt="Registrarse"/>
                  </center>
                  <input type="hidden" name="link" value="registroUsuario.php" />
                <a href="recuperarClave.php"  style="font-size: 9px ">No recuerdas tu contraseña?</a>
                <!--
                <form name="recuperar_Contraseña" action="recuperar_Contraseña.php" method="POST">

                </form>
                -->
              </table>
            </form>
            </div>
          </div>
<script language="javascript">
  $("#signin_menu").hide();
  $("#register_menu").hide();
  function salio(){
    alert("Salio");
  }

  function noNumber(evt){
//  var key = evt.charCode;
//	if (!evt) var evt = window.event;
//  var key = evt.keyCode;
		var key = (evt.keyCode) ? evt.keyCode : evt.charCode;
		alert(isDigit(evt.keyCode));
    if ((65 <= key && key <= 90) ||
         key ==241 ||
         key == 32 ||
         (97 <= key && key <= 122) ||
         key == 0){
      return true;
    }
    return false;
  }

  function swap(){
    if (document.registroUsuario.persona.value == 0){
      document.getElementById('rapellido').setAttribute('style','visibility: hidden');
      document.getElementById('apellido_top').setAttribute('style','visibility: hidden');
    }else{
      document.getElementById('rapellido').setAttribute('style','visibility: visible');
    }
  }

  function verifTel(evt){
    var key = evt.charCode;
    if (key == 0)
      return true;
    if (document.registroUsuario.telefono.value.length == 11)
      return false;
    if ((48 <= key && key <= 57))
      return true;
    return false;
  }

  function verifCITam(){
    var ExpCedula = /^[0-9]{4,8}$/;
    if (document.registroUsuario.ci.value.match(ExpCedula)){
      if (document.registroUsuario.persona.value == 1 && document.registroUsuario.ci.value.length > 4 &&
              document.registroUsuario.ci.value.length < 9)
        document.getElementById("ci_top").setAttribute('style','visibility: hidden');
      else if (document.registroUsuario.persona.value == 0 && document.registroUsuario.ci.value.length > 4 &&
              document.registroUsuario.ci.value.length < 10)
        document.getElementById("ci_top").setAttribute('style','visibility: hidden');
      else
        document.getElementById("ci_top").setAttribute('style','visibility: visible');
    }else{
      document.getElementById('ci_top').innerHTML="*introducir una CI o RIF.";
      document.getElementById("ci_top").setAttribute('style','visibility: visible');
    }

  }

  function verifCI(evt){
    var key = evt.charCode;
    if (key == 0)
      return true;
    if (document.registroUsuario.persona.value == 1 && document.registroUsuario.ci.value.length == 8)
      return false;
    if (document.registroUsuario.persona.value == 0 && document.registroUsuario.ci.value.length == 9)
      return false;
    if (48 <= key && key <= 57){
      return true;
    }
    return false;
  }

  function verifDistintas(){
    if (document.registroUsuario.contrasena.value != document.registroUsuario.repetida.value)
      document.getElementById('clave_top').setAttribute('style','visibility: visible');
    else
      document.getElementById('clave_top').setAttribute('style','visibility: hidden');
  }

  function verifTelTam(){
    var ExpNum = /^[0-9]+$/;
    if (document.registroUsuario.telefono.value.length < 11 ||
      !document.registroUsuario.telefono.value.match(ExpNum)){
      document.getElementById('telefono_top').innerHTML="*telefono incorrecto.";
      document.getElementById('telefono_top').setAttribute('style','visibility: visible');
    }
    else{
      document.getElementById('telefono_top').setAttribute('style','visibility: hidden');
    }
  }

  function verifCorreo(){
    var ExpRegCorreo = /^\w{3}([\.]*?[-]*?[_]*?\w+)*@\w{3}([\.-]?\w+)*(\.\w{2,4})+$/;
    if (!document.registroUsuario.correo.value.match(ExpRegCorreo)){
      document.getElementById('correo_top').setAttribute('style','visibility: visible');
      document.getElementById('correo_top').innerHTML="*correo incorrecto.";
    }
    else{
      document.getElementById('correo_top').setAttribute('style','visibility: hidden');
    }
  }

  function verifApellido(){
    var ExpRegNombre = /^[a-zA-Z]*([ ]{0,1}[a-zA-Z])*$/;
    var vacio =/^$/;
    if (!document.registroUsuario.apellido.value.match(ExpRegNombre) &&
        !document.registroUsuario.apellido.value.match(vacio) ){
      document.getElementById('apellido_top').innerHTML="*Solo letras."
      document.getElementById('apellido_top').setAttribute('style','visibility: visible');
    }
    else{
      document.getElementById('apellido_top').setAttribute('style','visibility: hidden');
    }
  }

  function verifNombre(){
    var ExpRegNombre = /^[a-zA-Z]*([ ]{0,1}[a-zA-Z])*$/;
    var vacio =/^$/;
    if (!document.registroUsuario.nombre.value.match(ExpRegNombre) &&
        !document.registroUsuario.nombre.value.match(vacio) ){
      document.getElementById('nombreMsn').innerHTML="*Introduzca nombre de pila.";
      document.getElementById('nombreMsn').setAttribute('style','visibility: visible');
    }
    else{
      document.getElementById('nombreMsn').setAttribute('style','visibility: hidden');
    }
  }

  function comprueba(){
    var ExpRegCorreo = /^\w{3}([\.]*?[-]*?[_]*?\w+)*@\w{3}([\.-]?\w+)*(\.\w{2,4})+$/;
    var ExpRegNombre = /^[a-zA-Z]*([ ]{0,1}[a-zA-Z])*$/;
    var ExpNum = /^[0-9]+$/;
    cor = true;
    if(document.forms.registroUsuario.contrasena.value != document.forms.registroUsuario.repetida.value){
      document.getElementById('clave_top').setAttribute('style','visibility: visible');
      document.getElementById('clave_top').innerHTML="*contraseñas distintas.";
      cor = false;
    }
    if (document.forms.registroUsuario.contrasena.value == ""){
      document.getElementById('clave_top').setAttribute('style','visibility: visible');
      document.getElementById('clave_top').innerHTML="*introducir una contraseña.";
      cor = false;
    }
    if (document.forms.registroUsuario.contrasena.value.length < 5){
      document.getElementById('clave_top').setAttribute('style','visibility: visible');
      document.getElementById('clave_top').innerHTML="*la contrasena debe tener al menos 5 caracteres.";
      cor = false;
    }
    if (document.forms.registroUsuario.correo.value == ""){
      document.getElementById('correo_top').innerHTML="*introducir un correo.";
      document.getElementById('correo_top').setAttribute('style','visibility: visible');
      cor = false;
    }
    else if (!document.forms.registroUsuario.correo.value.match(ExpRegCorreo)){
      document.getElementById('correo_top').innerHTML="*correo incorrecto.";
      document.getElementById('correo_top').setAttribute('style','visibility: visible');
      cor = false;
    }else{
      document.getElementById('correo_top').setAttribute('style','visibility: hidden');
    }
    if (document.forms.registroUsuario.nombre.value == ""){
      document.getElementById('nombreMsn').innerHTML="*introducir un nombre.";
      document.getElementById('nombreMsn').setAttribute('style','visibility: visible');
      cor = false;
		}else if (!document.registroUsuario.nombre.value.match(ExpRegNombre)){
      document.getElementById('nombreMsn').innerHTML="*Introduzca nombre de pila.";
      document.getElementById('nombreMsn').setAttribute('style','visibility: visible');
		}else{
      document.getElementById('nombreMsn').setAttribute('style','visibility: hidden');
    }
    if (document.registroUsuario.ci.value == "" ||
        document.registroUsuario.ci.length < 8 ||
        !document.registroUsuario.ci.value.match(ExpNum)){
      document.getElementById('ci_top').innerHTML="*introducir una CI o RIF.";
      document.getElementById('ci_top').setAttribute('style','visibility: visible');
      cor = false;
    }else{
      document.getElementById('ci_top').setAttribute('style','visibility: hidden');
    }
    if (document.registroUsuario.persona.value == 1){
      if (document.forms.registroUsuario.apellido.value == ""){
        document.getElementById('apellido_top').innerHTML="*introducir un apellido.";
        document.getElementById('apellido_top').setAttribute('style','visibility: visible');
        cor = false;
      }else{
        document.getElementById('apellido_top').setAttribute('style','visibility: hidden');
      }
    }
    if (document.registroUsuario.ci.value.length <= 3){
      document.getElementById('ci_top').innerHTML="*cedula invalida.";
      document.getElementById('ci_top').setAttribute('style','visibility: visible');
      cor = false;
    }
    if (document.forms.registroUsuario.telefono.value.length != 11){
      document.getElementById('telefono_top').innerHTML="*introducir telefono valido.";
      document.getElementById('telefono_top').setAttribute('style','visibility: visible');
      cor = false;
    }else if (!document.registroUsuario.telefono.value.match(ExpNum)){
      document.getElementById('telefono_top').innerHTML="*introducir telefono valido.";
      document.getElementById('telefono_top').setAttribute('style','visibility: visible');
      cor = false;
    }else{
      find = false;
      cod = document.registroUsuario.telefono.value.substring(0,4);
      lcod = new Array("0414","0412","0416","0424","0426","0212","0248","0281","0283","0282","0285","0292","0240","0247","0277","0278","0243","0244","0246","0273","0278","0284","0285","0286","0288","0289","0241","0242","0243","0245","0249","0258","0287","0259","0268","0269","0279","0235","0238","0246","0247","0251","0252","0253","0271","0274","0275","0234","0239","0291","0292","0287","0295","0255","0256","0257","0272","0293","0294","0275","0276","0277","0271","0272","0253","0254","0261","0262","0263","0264","0265","0266","0271");
      for(i = 0 ; i <lcod.length && !find;i++){
        if (lcod[i] == cod){
          find = true;
        }
      }
      if (!find){
        document.getElementById('telefono_top').setAttribute('style','visibility: visible');
        document.getElementById('telefono_top').innerHTML="*codigo de area invalido.";
        cor = false;
      }
    }
    if (cor)
      document.registroUsuario.submit();
  }
</script>
          <div class="apple_overlay" id="overlay">
                <div class="contentWrap"></div>
          </div>
          <script language="JavaScript" type="text/javascript">

            $("#boton_login").click(function() {
            $("#register_menu").hide();
            $("#signin_menu").toggle("slow");
            });

            $("#boton_login2").click(function() {
            $("#signin_menu").toggle("slow");
            });


            $("#boton_register").click(function() {
            $("#signin_menu").hide();
            $("#register_menu").toggle("slow");
            });

            $("#boton_register2").click(function() {
            $("#register_menu").toggle("slow");
            });


            $(function() {
              // if the function argument is given to overlay,
              // it is assumed to be the onBeforeLoad event listener
              $("a[rel]").overlay({
                mask: '#A1EAFD',
                effect: 'apple',
                onBeforeLoad: function() {
                  // grab wrapper element inside content
                  var wrap = this.getOverlay().find(".contentWrap");
                  // load the page specified in the trigger
                  wrap.load(this.getTrigger().attr("href"));
                }
              });
            });
          </script>
          <?php
            } else{
          ?>
            <div align="right" style="font-size: 13px; padding-top: 10px;">
              <table>
                <tr>
                  <td style="font-size: 13px;padding-left: 8px; padding-right: 8px;" >
                    <?php echo $_SESSION["nombreusr"]; ?>
                  </td>
                  <td bgcolor="#3E79B3" width="1px" height="20px" ></td>
                  <td style="font-size: 13px;padding-left: 8px; padding-right: 8px;" >
                    <a href="PanelUsuario.php" style="text-decoration: none;" >Ir a mi cuenta</a>
                  </td>
                  <td bgcolor="#3E79B3" width="1px" height="20px" ></td>
                  <td style="font-size: 13px;padding-left: 8px; padding-right: 8px;" >
                    <a href="logout.php" style="text-decoration: none; ">Salir</a>
                  </td>
                </tr>
              </table>
            </div>
          <?php
            }
          ?>
            <div style="float: right;margin-top: 8px;">
              <img src="images/top_low/logos/contacto_def.jpg"/>
              <form action="catalogo.php" method="POST">
                <table>
                  <tr>
                    <td>
                      <input id="ama" style="width: 196px;" name="busq"></input>
                    </td>
                    <td align="center">
                      <input type="image" src ="images/top_low/logos/bot-buscar-def.jpg" alt="Buscar"/>
                    </td>
                  </tr>
                </table>
              </form>
            </div>
      </div>
    <div id="menu" style="margin-top: 2px;">
      <ul class="menu">
        <li><a href="index.php"><span>PRINCIPAL</span></a></li>
        <li><a href="catalogo.php?tipo=0&marca=todas&procesador=&precio=&min=Todas&discomin=&pantalla=&x=18&y=15&organizar=0&num=15"><span>CAT&Aacute;LOGO LAPTOPS</span></a></li>
        <li><a href="comoComprar.php"><span>CÓMO COMPRAR</span></a></li>
        <li><a href="garantias.php"><span>GARANTÍA</span></a></li>
        <li><a href="contactenos.php"><span>CONTACTENOS</span></a></li>
        <li><a href="somos.php"><span>QUIENES SOMOS</span></a></li>
      </ul>
        <?php if($_SESSION["tipo"]==1){?>
          <td><a href="editarSimple.php" style="color: #FF9900">Edici&oacute;n de Productos </a></td>
          <td><a href="admin.php" style="color: #FF9900">Administraci&oacute;n</a></td>
        <? }else if ($_SESSION["autenticado"]==1){?>
        <?} ?>
      </div>